Ah duh... I was over-complicating it. Thanks for your help! I'll give that a shot.
That works great. Now running into a new issue. When I turn on"Rifles Only" I want all the other "only" selections to be off. I would have thought something like this would work:
case "cb_rifleonly": if (local.player isadmin) { local.admin_name = netname local.player setcvar "driving" local.admin_name stuffsrv ("toggle " + local.command) wait 1 if(getcvar(local.command) == 1) { setcvar "cb_sniperonly" "0" setcvar "cb_smgonly" "0" setcvar "cb_mgonly" "0" setcvar "cb_rocketonly" "0" setcvar "cb_shotgunonly" "0" setcvar "cb_pistolonly" "0" setcvar "cb_dualrifle" "0" setcvar "cb_boltaction" "0" setcvar "cb_allweapons" "0" setcvar "cb_bashonly" "0" } wait 1 for (local.i = 1; local.i <= $player.size; local.i++) { local.player = $player[local.i] if (local.player) { local.player stufftext ("set " + local.command + " " + (getcvar(local.command))) if(getcvar(local.command) == 1) { local.player stufftext ("set cb_sniperonly 0") local.player stufftext ("set cb_smgonly 0") local.player stufftext ("set cb_mgonly 0") local.player stufftext ("set cb_rocketonly 0") local.player stufftext ("set cb_shotgunonly 0") local.player stufftext ("set cb_pistolonly 0") local.player stufftext ("set cb_dualrifle 0") local.player stufftext ("set cb_boltaction 0") local.player stufftext ("set cb_allweapons 0") local.player stufftext ("set cb_bashonly 0") } } } } break
but it's not setting server or client variables when I turn "Sniper Only" to 1 and "Rifle Only" to 1 (expected behavior is that sniper only would go to 0 when rifle only goes to 1).
Does anything stick out at you for why this wouldn't be setting the variables?
help.png
probably the command values are stated as a string, not as an integer
try changing this
if(getcvar(local.command) == 1)
to this
if(getcvar(local.command) == "1")
Any cvar you get will always retrieve as string unless you convert first to the type you whant:
if(getcvar(int(local.command) == 1)
Last edited by DoubleKill; January 1st, 2019 at 03:57 AM.
in this case both ways lead to the same result, so not really
just different ways to check the same thing